home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet multimedia / Muzyka / Edytory sampli (probek dzwieku) / ZynAddSubFX_2.2.0 / Setup_ZynAddSubFX-2.2.0.exe / source code / Params / LFOParams.C < prev    next >
C/C++ Source or Header  |  2005-03-14  |  3KB  |  92 lines

  1. /*
  2.   ZynAddSubFX - a software synthesizer
  3.  
  4.   LFOParams.C - Parameters for LFO
  5.   Copyright (C) 2002-2005 Nasca Octavian Paul
  6.   Author: Nasca Octavian Paul
  7.  
  8.   This program is free software; you can redistribute it and/or modify
  9.   it under the terms of version 2 of the GNU General Public License 
  10.   as published by the Free Software Foundation.
  11.  
  12.   This program is distributed in the hope that it will be useful,
  13.   but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.   GNU General Public License (version 2) for more details.
  16.  
  17.   You should have received a copy of the GNU General Public License (version 2)
  18.   along with this program; if not, write to the Free Software Foundation,
  19.   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  20.  
  21. */
  22.  
  23. #include <math.h>
  24. #include <stdio.h>
  25. #include "../globals.h"
  26. #include "LFOParams.h"
  27.  
  28. int LFOParams::time;
  29.  
  30. LFOParams::LFOParams(char Pfreq_,char Pintensity_,char Pstartphase_, char PLFOtype_,char Prandomness_, char Pdelay_,char Pcontinous_,char fel_):Presets(){
  31.     switch(fel_) {
  32.     case 0:setpresettype("Plfofrequency");
  33.         break;
  34.     case 1:setpresettype("Plfoamplitude");
  35.         break;
  36.     case 2:setpresettype("Plfofilter");
  37.         break;
  38.     };
  39.     Dfreq=Pfreq_;
  40.     Dintensity=Pintensity_;
  41.     Dstartphase=Pstartphase_;
  42.     DLFOtype=PLFOtype_;
  43.     Drandomness=Prandomness_;
  44.     Ddelay=Pdelay_;
  45.     Dcontinous=Pcontinous_;
  46.     fel=fel_;
  47.     time=0;
  48.     
  49.     defaults();
  50. };
  51.  
  52. LFOParams::~LFOParams(){
  53. };
  54.  
  55. void LFOParams::defaults(){
  56.     Pfreq=Dfreq/127.0;
  57.     Pintensity=Dintensity;
  58.     Pstartphase=Dstartphase;
  59.     PLFOtype=DLFOtype;
  60.     Prandomness=Drandomness;
  61.     Pdelay=Ddelay;
  62.     Pcontinous=Dcontinous;
  63.     Pfreqrand=0;
  64.     Pstretch=64;
  65. };
  66.  
  67.  
  68. void LFOParams::add2XML(XMLwrapper *xml){
  69.     xml->addparreal("freq",Pfreq);
  70.     xml->addpar("intensity",Pintensity);
  71.     xml->addpar("start_phase",Pstartphase);
  72.     xml->addpar("lfo_type",PLFOtype);
  73.     xml->addpar("randomness_amplitude",Prandomness);
  74.     xml->addpar("randomness_frequency",Pfreqrand);
  75.     xml->addpar("delay",Pdelay);
  76.     xml->addpar("stretch",Pstretch);
  77.     xml->addparbool("continous",Pcontinous);
  78. };
  79.  
  80. void LFOParams::getfromXML(XMLwrapper *xml){
  81.     Pfreq=xml->getparreal("freq",Pfreq,0.0,1.0);
  82.     Pintensity=xml->getpar127("intensity",Pintensity);
  83.     Pstartphase=xml->getpar127("start_phase",Pstartphase);
  84.     PLFOtype=xml->getpar127("lfo_type",PLFOtype);
  85.     Prandomness=xml->getpar127("randomness_amplitude",Prandomness);
  86.     Pfreqrand=xml->getpar127("randomness_frequency",Pfreqrand);
  87.     Pdelay=xml->getpar127("delay",Pdelay);
  88.     Pstretch=xml->getpar127("stretch",Pstretch);
  89.     Pcontinous=xml->getparbool("continous",Pcontinous);
  90. };
  91.  
  92.